package com.yanqu.road.server.cmd.smallgame;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.smallgame.SmallGameProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.smallgame.SmallGameModule;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = GameProtocol.S_SMALLGAME_CHALLENGE_START, desc = "小游戏开始验证")
public class SmallGameChallengeStartDataCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        SmallGameProto.ChallengeStartReqMsg reqMsg = SmallGameProto.ChallengeStartReqMsg.parseFrom(packet.getBytes());
        int ret = player.getModule(SmallGameModule.class).startCheck(reqMsg.getType(), reqMsg.getStageId());
        player.sendPacket(Protocol.U_SMALLGAME_CHALLENGE_START,
                SmallGameProto.ChallengeStartRespMsg.newBuilder().setRet(ret).setType(reqMsg.getType()).setStageId(reqMsg.getStageId()));
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
